﻿using FluentNHibernate.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mscook.core.domain
{
    public class CookBookMap : ClassMap<CookBook>
    {
        public CookBookMap()
        {
            Id(o => o.Id);
            Map(o => o.CreateTime);
            Map(o => o.IsDelete);
            Map(o => o.Version);
            Map(o => o.EntityIndex);
            Map(o => o.Summary).CustomType("StringClob");
            Map(o => o.Name);
            Map(o => o.Description).CustomType("StringClob");
            Map(o => o.ImageName);
            Map(o=>o.Editor);
            References<Chef>(o => o.Chef).Nullable().Column("ChefId");
            References<ResourceBonusSetting>(o=>o.ResourceBonusSetting).Cascade.All();

            HasMany<MaterialOfCookBook>(o => o.MaterialOfCookBooks).KeyColumn("CookBookId");
        }
    }
}
